package com.lebang.medicalInquiry.model.vo;



import com.lebang.medicalInquiry.model.po.User;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * tb_user
 *
 * @author
 */
@Data
@ApiModel("用户管理表 ")
public class UserInfoVo implements Serializable {
    /**
     * id
     */
    @ApiModelProperty("id")
    private Integer id;

    /**
     * create_time
     */
    @ApiModelProperty("create_time")
    private LocalDateTime createTime;


    /**
     * state
     */
    @ApiModelProperty("state")
    private Integer state;


    /**
     * uuid
     */
    @ApiModelProperty("uuid")
    private String uuid;


    /**
     * 昵称
     */
    @ApiModelProperty("昵称")
    private String name;

    /**
     * 头像
     */
    @ApiModelProperty("头像")
    private String headImg;


    /**
     * 账号
     */
    @ApiModelProperty("账号")
    private String account;


    /**
     * 过期时间
     */
    @ApiModelProperty("过期时间")
    private LocalDateTime expireTime;


    /**
     * 角色
     */
    @ApiModelProperty("角色")
    private String role;

    private static final long serialVersionUID = 1L;

    //    public User insertPo() {
//        User po = new User();
//        if (this.id == null) {
//            po.setCreateTime(LocalDateTime.now());
//        } else {
//            po.setId(this.id);
//        }
//        po.setUpdateTime(LocalDateTime.now());
//        po.setState(this.state);
//        po.setUuid(this.uuid);
//        po.setNickName(this.nickName);
//        return po;
//    }
//
    public static UserInfoVo buildVo(User user) {
        UserInfoVo po = new UserInfoVo();
        po.setCreateTime(user.getCreateTime());
        po.setUuid(user.getUuid());
        po.setUuid(user.getUuid());
        po.setAccount(user.getPhoneNumber());
        po.setState(user.getState());
        po.setName(user.getName());
        po.setHeadImg(user.getHeadImg());

        return po;
    }

}